home *** CD-ROM | disk | FTP | other *** search
/ MacHack 1994 / MacHack 1994.toast / MacHack™94 / Talks & Papers / Timothy Knox / yerk 3.66 / Module source / inDlg < prev    next >
Text File  |  1994-06-24  |  2KB  |  80 lines

  1. \ general-purpose input dialog support
  2. \ 12/22/84  cbd Version 1
  3. \ 12/03/85  cdn Added close: inDlg in doInDlg for new Dialog
  4. \  7/06/86  cdn Added 6 check box items & doDeDlg for decompiler
  5. \  9/02/86  cdn Added doGrDlg for grep utility
  6. \ 12/17/87    rfl    fixed so that current resource file is retained
  7. \  9/01/88    rfl removed draw: fwind
  8. \ 12/26/90    rfl modified to agree with new dialog starting with element #1, not 0
  9. \  5/22/92    rfl    refresh fwind if alive
  10. \ 12/21/92    rfl removed resource stuff
  11.  
  12. Decimal
  13.  
  14.  :Module  indMod
  15.  
  16. // Dialog
  17. Forget ParamText
  18. 11 dialog inDlg
  19. 1 hilite: inDlg
  20.  
  21. \ stubs for utilities
  22. \ ( -- addr len t )  Get response string
  23. : getChoice
  24.     4 getText: inDlg
  25.     -dup IF str255 -base count True ELSE drop False THEN ;
  26.  
  27. 4 'cfas getChoice False False getChoice
  28. 6 'cfas togItem togItem togItem togItem togItem togItem actions: inDlg
  29.  
  30. \ ( addr len -- addr len t OR f )  Do input dialog with string prompt
  31. \ If user enters a string, it is left on the stack for the application.
  32. : doInDlg 
  33.     3 init: inDlg getNew: inDlg
  34.     3 putText: inDlg
  35.     0 255 4 setSelect: inDlg
  36.     modal: inDlg
  37.     close: inDlg
  38.     ( draw: fWind )  ;
  39.  
  40. \ ( flgs #boxes -- )  set current box settings
  41. : putBoxes
  42.     5 + 1+ 5 DO
  43.         dup 1 and
  44.         IF 1 i put: inDlg THEN
  45.         1 >>
  46.     LOOP drop ;
  47.  
  48. \ ( #boxes -- flgs )  get current box settings
  49. : getBoxes
  50.     0 4 rot 5 +
  51.     DO    1 <<
  52.         i get: inDlg IF 1 or THEN
  53.     -1 +LOOP ;
  54.  
  55. \ ( addr len -- addr len t OR f )  Do input dialog for Grep
  56. \ If user enters a string, it is left on the stack for the application.
  57. : doGrDlg 
  58.     5 init: inDlg getNew: inDlg
  59.     3 putText: inDlg
  60.     0 255 4 setSelect: inDlg
  61.     grflgs 3 putBoxes                \ show current options
  62.     modal: inDlg dup
  63.     IF 3 getBoxes -> grflgs THEN    \ store new options
  64.     close: inDlg
  65.     alive: fwind IF draw: fWind THEN ;
  66.  
  67. \ ( addr len -- addr len t OR f )  Do input dialog for the Decompiler
  68. \ If user enters a string, it is left on the stack for the application.
  69. : doDeDlg 
  70.     6 init: inDlg getNew: inDlg
  71.     3 putText: inDlg
  72.     0 255 4 setSelect: inDlg
  73.     deflgs 5 putBoxes                \ show current options
  74.     modal: inDlg dup
  75.     IF 5 getBoxes -> deflgs THEN    \ store new options
  76.     close: inDlg
  77.     alive: fwind IF draw: fWind THEN ;
  78.  
  79.  ;Module
  80.